package com.yunxi.service.eai.impl;

import com.yunxi.bizToHub.pojo.EaiLogs;
import com.yunxi.bizToHub.service.EaiLogBizToHubService;
import com.yunxi.core.base.Constant;
import com.yunxi.core.web.ApiResult;
import com.yunxi.model.eai.EaiLog;
import com.yunxi.service.eai.EaiLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.Date;

/**
 * Created by Administrator on 2019/6/28.
 */
public class EaiLogsServiceImpl implements EaiLogBizToHubService {
    @Autowired
    @Qualifier("eaiLogServiceImpl")
    EaiLogService eaiLogService;

    @Override
    public void saveWeekPlanEaiLog(EaiLogs eaiLogs) {

        EaiLog eaiLog = new EaiLog();
        eaiLog.setPmsEaiContent(eaiLogs.getPmsEaiContent());
        eaiLog.setPmsEaiText(eaiLogs.getPmsEaiContent());
        eaiLog.setFlowDesc("PMS系统发送周计划给SAP系统");
        eaiLog.setSourceSystem(Constant.PMS);
        eaiLog.setServiceName(Constant.SAP_WEEK_PLAN);
        eaiLog.setType(1);
        eaiLog.setDisposeStatus(0);
        eaiLog.setCreateDate(new Date());
        eaiLogService.saveOrUpdate(eaiLog);

    }

    @Override
    public void saveMonthPlanEaiLog(EaiLogs eaiLogs) {
        EaiLog eaiLog = new EaiLog();
        eaiLog.setType(1);
        eaiLog.setPmsEaiContent(eaiLogs.getPmsEaiContent());
        eaiLog.setPmsEaiText(eaiLogs.getPmsEaiContent());
        eaiLog.setRequestSendTime(new Date());
        eaiLog.setFlowDesc("PMS系统发送月计划给SAP系统");
        eaiLog.setSourceSystem(Constant.PMS);
        eaiLog.setServiceName(Constant.SAP_MONTH_PLAN);
        eaiLog.setDisposeStatus(0);
        eaiLog.setCreateDate(new Date());
        eaiLogService.saveOrUpdate(eaiLog);
    }
}
